package com.atguigu.springcloud.alibaba.config;

import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
import com.atguigu.springcloud.alibaba.myfallback.MyFallBack;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @auther zzyy
 * @create 2020-02-13 20:27
 */
@Configuration
public class ApplicationContextBean
{
    @Bean
    @LoadBalanced
    @SentinelRestTemplate(fallback = "fallback01",fallbackClass = MyFallBack.class)
    public RestTemplate getRestTemplate()
    {
        return new RestTemplate();
    }
}
